package com.gupao.spring.pattern.factory.SimpleFactory;

import com.gupao.spring.pattern.factory.HuaWei;
import com.gupao.spring.pattern.factory.Phone;
import com.gupao.spring.pattern.factory.Vivo;
import com.gupao.spring.pattern.factory.XiaoMi;

public class SimpleFactory {

    public   Phone getPhoneByName(String name){

        if ("小米".equals( name )){

            return new XiaoMi();

        }else if ("华为".equals( name )){

            return new HuaWei();

        }else if ("Vivo".equals( name )){

            return new Vivo();
        }
        return  null;
    }

}
